package com.example.lvsuo.Execl.Execldaoru;

import com.example.lvsuo.Execl.Execldaochu.ExeclService;

import com.example.lvsuo.mapper.TaskMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class TaskService {
    @Autowired
    ExeclService es;

    //改为自己的Mapper----------
    @Autowired
    TaskMapper taskMapper;

    public void lists(List toString) {
        List<Map<String,String>> ZHONGYAO= new ArrayList<>();
        List<String> header =new ArrayList<>();
        //  改 Task参数为要导入的哪张表的 表名 ----------
        List<Map<String,Object>>  ziduan= es.ziduanANDzhushi("Task");
        for (int i = 0; i <ziduan.size() ; i++) {
            header.add(ziduan.get(i).get("zds").toString());
        }
        for (int i = 0; i <toString.size() ; i++) {
            HashMap hashMap = new HashMap();
            List     q= (List) toString.get(i);
            for (int j = 0; j <q.size() ; j++) {
                hashMap.put(header.get(j),q.get(j));
            }
            ZHONGYAO.add(hashMap);
        }
        //改方法为mapper的方法---参数固定不可改变---------
        taskMapper.selectlistq(ZHONGYAO);
    }
}
